<!DOCTYPE html>

<html lang="en">
  <meta charset="utf-8" />
  <title>ICERender-clear-rect</title>
  <body>
    <canvas id="canvas-1" width="1024" height="768" style="background-color: #f7f7f7;"></canvas>
    <script type="text/javascript">
      //测试 clearRect
      let canvas = document.getElementById('canvas-1');
      let ctx=canvas.getContext('2d');

      ctx.fillStyle = '#ff0000';
      ctx.beginPath();
      ctx.fillRect(100,100,500,500);
      ctx.closePath();

      ctx.fillStyle="#00ff00";
      ctx.beginPath();
      ctx.fillRect(100,100,300,300);
      ctx.closePath();

      ctx.clearRect(200,200,100,100);//清空矩形区域的所有像素

    </script>
  </body>
</html>
